package com.schoolCommunity.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.schoolCommunity.entity.Commodity;
import com.schoolCommunity.entity.Information;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author YTH
 * @since 2020-10-10
 */
public interface CommodityService extends IService<Commodity> {

    //用户添加一个商品
    public Information InsertCommodity(Commodity commodity) throws IOException;

    //用户上传商品图片
    public Information UpdateCommodityPicture(MultipartFile file, long CommodityId) throws IOException;

    //用户主动下架商品
    public Information soldOutCommodity(long CommodityId) throws IOException;

    //获取我的商品
    public Information GetMyCommodity(long memberId);

    //分页获取批准上架的商品,暂定20每页
    public Information GetCommodityPage(int PageNo);

    //获取最大分页
    public long GetMaxPageNo();

    //用户购买商品,传入购买的用户id以及商品id
    public Information BuyCommodity(long BuyMemberId, long CommodityId);

    //管理员功能，删除某个商品
    public Information DeleteCommodity(long commodityId);

    //管理员功能，审核某个商品
    public Information SuggestCommodity(long commodityId, int suggestResult);

    //管理员功能，获取尚未审核的商品
    public Information GetNoSuggestCommodity(long pageNo);

    //获取最大为分页数据
    public long GetNoSuggestCommodityMaxPage();

    //获取所有未上架的商品
    public Information GetAllNoOnCommodity(long pageNo);

    //获取所有未上架的商品最大页数
    public long GetAllNoOnCommodityMaxPage();

    //上架某个商品
    public Information PutOnCommodity(long CommodityId);

}
